<?php
defined('SYSPATH') OR die('No direct access allowed.');
/**
 * MAPI COA Project
 * cutomer.php
 * @author ranuandra
 *
 * 22 Jul 2011
 * tags
 */

class Model_Customer extends ORM
{
		protected $_has_many = array(
									'productspec' 	=> array('model' => 'productspec'),
								);
								
	private $field = array(
						'name', 'address','postcode','phone',
					);
					
	private $form = array(
						'name' 				=> '',
						'address' 				=> '',
						'postcode' 				=> '',
						'phone' 				=> '',
					);
					
					
	public function rules()
	{
		return array(
			'name' 	   => array(
			 						array('min_length', array(':value', 0)),
			 ),
			'address' 	   => array(
			 						array('min_length', array(':value', 0)),
			 ),
			'postcode' 	   => array(
			 						array('min_length', array(':value', 0)),
			 ),
			'phone' 	   => array(
			 						array('min_length', array(':value', 0)),
			 ),

		);
	}
	
	public function getForm()
	{
		return $this->form;
	}
	
	public function getField()
	{
		return $this->field;
	}
	
	public function create_customer($values)
	{
		return $this->values($values, $this->field)->create();
	}
}

?>